//定义store
import { defineStore } from "pinia";
import { ref } from 'vue';
export const useTokenStore = defineStore('token', () => {
    //定义状态内容
    //1.响应式变量
    const token = ref('')
    //2.定义一个函数修改toke值
    const setToken = (newToken) => {
        token.value = newToken
    }
    //3.定义函数移除token
    const removeToken = () => {
        token.value = ''
    }
    //返回状态内容
    return {
        token,
        setToken,
        removeToken
    }
}    ,
    //参数持久化 刷新token不消失
    {
        persist: true
    }
);